import 'package:flutter/material.dart';
import 'package:flutter_app/pages/HomePage.dart';
import 'package:flutter_app/pages/MinePage.dart';
import 'package:flutter_app/pages/FoundPage.dart';

class BottomNavigationWidget extends StatefulWidget {
  @override
  _BottomNavigationWidgetState createState() => _BottomNavigationWidgetState();
}

class _BottomNavigationWidgetState extends State<BottomNavigationWidget> {
  final _BottomNavigationColor = Colors.blueAccent;

  int _currentIndex = 0;

  List<Widget> data = List();

  @override
  void initState() {
    data..add(HomPage())..add(FoundPage())..add(MinePage());
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: data[_currentIndex],
      bottomNavigationBar: BottomNavigationBar(
        items: [
          BottomNavigationBarItem(
              icon: Icon(
                Icons.home,
                color: _BottomNavigationColor,
              ),
              title: Text(
                "found",
                style: TextStyle(color: _BottomNavigationColor),
              )),
          BottomNavigationBarItem(
              icon: Icon(
                Icons.search,
                color: _BottomNavigationColor,
              ),
              title: Text(
                "mine",
                style: TextStyle(color: _BottomNavigationColor),
              )),
          BottomNavigationBarItem(
              icon: Icon(
                Icons.person,
                color: _BottomNavigationColor,
              ),
              title: Text(
                "home",
                style: TextStyle(color: _BottomNavigationColor),
              ))
        ],
        currentIndex: _currentIndex,
        onTap:(int index){
          setState(() {
            _currentIndex = index;
          });
        },
      ),
    );
  }
}
